3DWorld (75/293)

From:Paul Qureshi
Date:16 Apr 2000 at 21:59:30
Subject:Re: Crazy Taxi engine details

Hiya Steven.

> well ints are big =B12billion. If you had doubles that would enable you
> to easily map a city. doubles are sometimes faster than floats btw -
> they seem to be on the 040 anyway.

Good point. I guess you could translate to other systems quick enough
for when you wanted to do manipulation. However, that would require
extra CPU time and I have a feeling that there is another way, probably
based on the zones idea that I mentioned.

>> The next thing is the physics engine used for objects like cars and
>> boxes. It allows objects to tumble and fall realistically and roll
>> along. It's quite spectacular when several boxes go flying and bounce
>> away. I'd like to hear peoples ideas on how to impliment such an
>> engine. Note that object bounce off the ground and off each other, so
>> you need loads of collision detection, but it need not be 100%
>> accurate as things happen very fast.

> theres a couple of ways, none of which I have perfected yet so take
> what i say with some caution :O). you know where the centre of mass of
> an object is and you know where an objects verticies is. The
> penetration of that point and anothers polygon then enables you to
> calculate the linear and rotational force on the c.m. You can then do
> momentum+angular momentum calculation. At the end you get a modified
> momentum vector and a new axis of rotation.

I see. I'll have to try it, but it sounds like the right track.

> the other way is similar. again you look at the penetration of a
> point. The more it penetrates, the higher its force, like a spring.

I think I have seen that used on some games. Take Driver for instance,
if a cop gets hit hard enough you can send them seveal hundred meters
into the air. It seems to work fine until objects are moving too fast
and penetrate too much, so I guess you must limit it in some way.

> the object can be modeled as a collection of atoms that are sprung to
> each other - like latice simulations in physics - it means that a
> force on one will then be applied to all others and the object will
> move and tumble. For what its worth, for my game I'm trying to perfect
> the former.

I'd be interested to see your results, please post here when you finally
perfect it.

I was thinking of using a system where you first determine a collision
between too objects. Each object has a mass, and you use that and the
objects velocity to calculate it's new velocity. Because there is an
equal and opposite reaction to every action, when an object hits another
it not only picks up some of the momentum from the object it hit but
also some from the reaction to it's own movement. Therefore, even things
like the ground that don't move make other object bounce.

>> The next thing is the car you drive. This used the very fast
>> collision detection too. Each wheel seems to independantly checked,
>> as well as the body. You can drive over buildings (on the roof),
>> barriers (if you land on them) and even other cars. You can't flip
>> the car upside down, but I don't think that's a limitation of the
>> engine, more of the gameplay. Again, this comes back to the collision
>> detection, how do you manage so much of it so quickly with such
>> accuracy (it's not perfect, but very nearly)?

> it might know by LUT, what buildings are in each zone, so it only has
> to detect colisions with them.=20

Yeah, I thought that maybe it was using some quick way to see what
objects were near by. My guess is that while it's transforming objects
it also makes note of any that are near the car. It then only checks
those objects for collision, and even then it checks the collision speed
and determines how accuratly it needs to do the collision for it to look
okay.

> Then there is the cars, but they can be
> presorted as well to which of the many cars are likely to colide, then
> the pixel perfect collision detection can be used.

The only flaw with both our methods is that objects well away from the
players car (such as other moving cars, tables, boxes etc) can also
collide. You would need to check every object that is near by. My guess
is that only moving objects are checked. I think other than that there
must be some very fast collision detection code and a nice chunk of CPU
time to process it.

>> Oh, and the people standing around seem to be able to predict where
>> your car will go and if it will hit them. Is there a good algo for
>> this?

> On Beyond2000, there was a short piece about an industrial traffic
> simulation, the sort of things it considered for overtaking and stuff
> was gap acceptance. Each car if the gap is big enough will travel into
> a flow of traffic or overtake, but all will brake if something comes a
> head of them, they all have individual tailing distances too.

That sounds like the sort of thing I need. Is it available anywhere on
the web? I'll go see if I can find it..

Regards,
Paul
--=20
+---------------------------------------------+
| ## paul.qureshi@btinternet.com ## |
| Amiga 3D Graphics - www.mc68k.demon.co.uk |
| Amiga Coder - Asm/C/Blitz |
| Intel - Outside | +------------------------=
---------------------+